Skip to content

fix(changelog): preserve fenced code blocks in custom PR changelog entries#771

Merged
BYK merged 1 commit intomasterfrom
byk/fix/changelog-code-blocks
Mar 11, 2026
Merged

fix(changelog): preserve fenced code blocks in custom PR changelog entries#771
BYK merged 1 commit intomasterfrom
byk/fix/changelog-code-blocks

Conversation

@BYK
Copy link
Member

@BYK BYK commented Mar 11, 2026

Fenced code blocks (lang ... ) in custom ### Changelog Entry PR description sections were silently dropped during changelog generation.

Root Cause

Two functions in src/utils/changelog.ts only handled a subset of marked.lexer token types:

  1. extractNestedContent() — only handled list tokens. Code blocks inside list items (the reported scenario) were silently skipped.
  2. parseTokensToEntries() — only handled list and paragraph. Standalone code blocks after paragraphs were dropped.

Fix

Added code token handling to both functions:

  • extractNestedContent(): renders code blocks as indented fenced blocks with proper nesting
  • parseTokensToEntries(): attaches standalone code blocks as nestedContent on the previous entry

Changelog Entry

  • Fix fenced code blocks being silently dropped from custom changelog entries in PR descriptions

@BYK BYK marked this pull request as ready for review March 11, 2026 15:06
Copy link

@giortzisg giortzisg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix 🚀

@BYK BYK force-pushed the byk/fix/changelog-code-blocks branch from 830ecf3 to f727b97 Compare March 11, 2026 15:44
@BYK BYK force-pushed the byk/fix/changelog-code-blocks branch from f727b97 to a200fa9 Compare March 11, 2026 15:51
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

…tries

Code blocks (```lang ... ```) in custom Changelog Entry sections of PR
descriptions were silently dropped during parsing.

Root cause: two functions only handled a subset of marked.lexer token types:

1. extractNestedContent() only handled 'list' tokens — code blocks inside
   list items were skipped
2. parseTokensToEntries() only handled 'list' and 'paragraph' — standalone
   code blocks after paragraphs were skipped

Fix: add 'code' token handling to both functions:
- In extractNestedContent: render as indented fenced code block (2-space
  indent, matching sub-bullet level), properly handled during recursive
  indentation for deeper nesting
- In parseTokensToEntries: attach standalone code blocks as nestedContent
  on the previous entry, or create a new entry if no previous one exists
@BYK BYK force-pushed the byk/fix/changelog-code-blocks branch from a200fa9 to 637e842 Compare March 11, 2026 15:59
@BYK BYK merged commit 68bff82 into master Mar 11, 2026
17 checks passed
@BYK BYK deleted the byk/fix/changelog-code-blocks branch March 11, 2026 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants